<template>
  <MainLayout title="页面标题">
    <view class="p-12">
      <view class="title">{{ task?.name }}</view>
      <view class="blk">项目：{{ task?.projectName }}</view>
      <view class="blk">标准：{{ task?.standardName }}</view>
      <view class="blk">截止：{{ task?.deadlineStr }}</view>

      <button type="primary" @click="gotoFill('manual')">手动填报</button>
      <button @click="gotoFill('device')">设备采集</button>
    </view>
  </MainLayout>




</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { api } from '@/services/api'
import MainLayout from '@/layouts/MainLayout.vue'
const task = ref<any>(null)

onMounted(async ()=>{
  const id = (uni.getCurrentPages().pop() as any)?.options?.id
  task.value = await api.getTaskDetail(id)
})

function gotoFill(mode:'manual'|'device'){
  const id = task.value?.id
  const url = mode==='manual' ? `/pages/tasks/fill_manual?id=${id}` : `/pages/tasks/fill_device?id=${id}`
  uni.navigateTo({ url })
}
</script>

<style scoped>
.p-12{padding:12px}
.title{font-size:18px; font-weight:700; margin-bottom:10px}
.blk{background:#fff;border-radius:8px;padding:10px;margin-bottom:8px}
</style>
